feat(workflow): engine API with fakes#96
Conversation
agent/parallel/pipeline/phase/log/workflow primitives, semaphore, ALS phase, isolation worktree hook, nest depth 1, and executeWorkflow against injectable runProvider for unit tests. Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| "isolation: 'worktree' requires createWorktree host support", | ||
| ); | ||
| } | ||
| worktree = await deps.createWorktree({ |
There was a problem hiding this comment.
[P0] Worktree creation happens before beginAgentCall, but the catch path always calls failAgentCall. If setup fails (non-Git workspace, missing Git, bad base SHA, collision), the original error is masked by Unknown workflow agent call. Begin a preparing row before fallible setup, or guard failure journaling with a callStarted flag.
There was a problem hiding this comment.
Addressed by stacked PR #101 (d5b00f5). The agent path now tracks whether beginAgentCall actually succeeded and only calls failAgentCall for an existing row. A worktree setup failure preserves the original error and still emits a typed agent_call_failed event. A regression test makes createWorktree throw and verifies that the error is not replaced by Unknown workflow agent call. This thread becomes obsolete once #101 is merged.
| runId: deps.runId, | ||
| callIndex: index, | ||
| responseText: truncate(result.finalResponse, WORKFLOW_LIMITS.responseTextBytes), | ||
| structuredJson: structuredJson |
There was a problem hiding this comment.
[P1] Please do not truncate structured JSON. A truncated payload is invalid JSON; replay then silently falls back to response text and changes the return type from object to string. Reject oversized structured results or persist them as an artifact/reference. Only free-form response text should be truncated.
| // Child surface: reuse parent agent/parallel/pipeline/phase/log/budget/workflow | ||
| // so callIndex + semaphore stay shared. Override args + meta for the child body. | ||
| const childApi: WorkflowApi = { | ||
| agent: input.parentApi.agent, |
There was a problem hiding this comment.
[P1] Reusing the parent's agent closure also reuses the parent's meta and phase context, so a child's defaultProvider and phase semantics are not actually honored. Share only runtime state (semaphore, call counter, replay, signal, journal), then construct a child API with the child's own meta and args.
Summary
createWorkflowApi: agent/parallel/pipeline/phase/log/workflow + semaphore + ALS phaseexecuteWorkflowhost entry; nest depth 1; isolation worktree hookrunProvider(no real LLM)Stack
PR3 of 5 · base:
pr/dw-2-store-sandboxTest plan
tsx src/workflow-engine.test.tsnpm run typecheck